/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package common;

import java.io.File;
import java.io.FileWriter;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
/**
 *
 * @author user
 */
public class Client 
{
    private String fileSettings= "Clients.dat";
    private String name;        
    private String address;     
    private String phone;       
    private String city;        
    private String state;       
    private String country;     
    private String email;       
    private String folderName;  
    private String band;        
    private String price;       
    private String ftpUrl;      
    private String username;    
    private String password;    
    private String ftpUsername; 
    private String ftpPassword;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }


    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }


    public String getCity() {
        return city;
    }

    public void setCity(String city) {
        this.city = city;
    }


    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }


    public String getCountry() {
        return country;
    }

    public void setCountry(String country) {
        this.country = country;
    }


    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }


    public String getFolderName() {
        return folderName;
    }

    public void setFolderName(String folderName) {
        this.folderName = folderName;
    }


    public String getBand() {
        return band;
    }

    public void setBand(String band) {
        this.band = band;
    }


    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }


    public String getFtpUrl() {
        return ftpUrl;
    }

    public void setFtpUrl(String ftpUrl) {
        this.ftpUrl = ftpUrl;
    }


    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }


    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }


    public String getFtpUsername() {
        return ftpUsername;
    }

    public void setFtpUsername(String ftpUsername) {
        this.ftpUsername = ftpUsername;
    }


    public String getFtpPassword() {
        return ftpPassword;
    }

    public void setFtpPassword(String ftpPassword) {
        this.ftpPassword = ftpPassword;
    }

    public void saveSetting() {
        FileWriter fo;
        PrintWriter pw;
        try {File ff = new File(fileSettings);
        if (!ff.exists()) ff.createNewFile();
        fo = new FileWriter(ff);
        pw = new PrintWriter(fo);
        pw.println(name);
        pw.println(address);
        pw.println(phone);
        pw.println(city);        
        pw.println(state);
        pw.println(country);        
        pw.println(email);
        pw.println(folderName);
        pw.println(band);
        pw.println(price);
        pw.println(ftpUrl);
        pw.println(username);
        pw.println(password);
        pw.println(ftpUsername);
        pw.println(ftpPassword);
        
        fo.close();
        pw.close();
        
        } catch (IOException e) {}
        
    }
    
    public void getSetting() {
        int tok;
        FileReader fr;
        StreamTokenizer stk;

        try {File ff = new File(fileSettings);
        if (!ff.exists()) return;
        fr = new FileReader(ff);
        stk = new StreamTokenizer(fr);
        stk.wordChars(0,255);
        stk.whitespaceChars('\n', '\n');
        if ((tok = stk.nextToken()) != StreamTokenizer.TT_EOF) name        = stk.sval.substring(0, stk.sval.length()-1).toString();
        if ((tok = stk.nextToken()) != StreamTokenizer.TT_EOF) address     = stk.sval.substring(0, stk.sval.length()-1).toString();        
        if ((tok = stk.nextToken()) != StreamTokenizer.TT_EOF) phone       = stk.sval.substring(0, stk.sval.length()-1).toString();
        if ((tok = stk.nextToken()) != StreamTokenizer.TT_EOF) city        = stk.sval.substring(0, stk.sval.length()-1).toString();         
        if ((tok = stk.nextToken()) != StreamTokenizer.TT_EOF) state       = stk.sval.substring(0, stk.sval.length()-1).toString();
        if ((tok = stk.nextToken()) != StreamTokenizer.TT_EOF) country     = stk.sval.substring(0, stk.sval.length()-1).toString();        
        if ((tok = stk.nextToken()) != StreamTokenizer.TT_EOF) email       = stk.sval.substring(0, stk.sval.length()-1).toString();
        if ((tok = stk.nextToken()) != StreamTokenizer.TT_EOF) folderName  = stk.sval.substring(0, stk.sval.length()-1).toString();
        if ((tok = stk.nextToken()) != StreamTokenizer.TT_EOF) band        = stk.sval.substring(0, stk.sval.length()-1).toString();
        if ((tok = stk.nextToken()) != StreamTokenizer.TT_EOF) price       = stk.sval.substring(0, stk.sval.length()-1).toString();
        if ((tok = stk.nextToken()) != StreamTokenizer.TT_EOF) ftpUrl      = stk.sval.substring(0, stk.sval.length()-1).toString();
        if ((tok = stk.nextToken()) != StreamTokenizer.TT_EOF) username    = stk.sval.substring(0, stk.sval.length()-1).toString();
        if ((tok = stk.nextToken()) != StreamTokenizer.TT_EOF) password    = stk.sval.substring(0, stk.sval.length()-1).toString();
        if ((tok = stk.nextToken()) != StreamTokenizer.TT_EOF) ftpUsername = stk.sval.substring(0, stk.sval.length()-1).toString();
        if ((tok = stk.nextToken()) != StreamTokenizer.TT_EOF) ftpPassword = stk.sval.substring(0, stk.sval.length()-1).toString();
        
        fr.close();
      
        } catch (IOException e) {}        
        
    }    
}
